<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        //设置cookie
        function setcookie(name, value, expries) {
            var str = name + '=' + value;
            if (typeof expries === 'number') {
                var d = new Date()
                d.setDate(d.getDate() + expries)
                str += ';expries' + d;
                document.cookie = str
            }
        }
        setcookie("七七","777",2)
        //获取cookie
        //cookie.html:13 username=dada; password=123456; 
        //__guid=111872281.4148287127900956000.1587388614907.4265
        function getCookie(name) {
            var cookie_arr = document.cookie.split("; ")
            for (var i = 0; i < cookie_arr.length; i++) {
                var cookie_item = cookie_arr[i]
                cookie_item = cookie_item.split("=")
                // console.log( '大大大'==name);
                
                if (cookie_item[0] == name) {
                    return cookie_item[1]
                }
            }
            return "123"
        }
        var res = getCookie("大大大")
        console.log(res);
        function removecookie(name){
            setcookie(name,"",-1)
        }

    </script>
</body>

</html>